from flask import Flask,render_template
import requests
from flask_apscheduler import APScheduler
scheduler=APScheduler()

app = Flask(__name__)

@app.route('/')
def post_stock():
    stock_parameter1=str(requests.get("http://qt.gtimg.cn/q=sh000001").text).split('~')
    stock_parameter2 = str(requests.get("http://qt.gtimg.cn/q=sz002838").text).split('~')
    # hongrun
    stock_parameter3 = str(requests.get("http://qt.gtimg.cn/q=sz002062").text).split('~')
    stock_parameter4 = str(requests.get("http://qt.gtimg.cn/q=sz002023").text).split('~')
    stock_parameter5 = str(requests.get("http://qt.gtimg.cn/q=sh600735").text).split('~')
    zzj1 = str(((float(stock_parameter1[3]) - float(stock_parameter1[4])) / float(stock_parameter1[3])) * 100)[:6]
    zzj1_1=stock_parameter1[3]
    zzj2 = str(((float(stock_parameter2[3]) - float(stock_parameter2[4])) / float(stock_parameter2[3])) * 100)[:6]
    zzj2_1=stock_parameter2[3]

    zzj3 = str(((float(stock_parameter3[3]) - float(stock_parameter3[4])) / float(stock_parameter3[3])) * 100)[:6]
    zzj3_1 = stock_parameter3[3]
    zzj4 = str(((float(stock_parameter4[3]) - float(stock_parameter4[4])) / float(stock_parameter4[3])) * 100)[:6]
    zzj4_1 = stock_parameter4[3]
    zzj5 = str(((float(stock_parameter5[3]) - float(stock_parameter5[4])) / float(stock_parameter5[3])) * 100)[:6]
    zzj5_1 = stock_parameter5[3]
    print(222222222222222222222222)
    return render_template('index.html',zzj1=zzj1,zzj1_1=zzj1_1,zzj2=zzj2,zzj2_1=zzj2_1,zzj3=zzj3,zzj3_1=zzj3_1,zzj4=zzj4,zzj4_1=zzj4_1,zzj5=zzj5,zzj5_1=zzj5_1)





if __name__ == '__main__':
    app.run()
